/**
 * Created by cuppi on 2017/6/17.
 */

let hookMap = {
  MineOrderDetail: {
    beforeRouteEnter: (to, from, next) => {
      next();
    },
    beforeRouteLeave: (to, from, next) => {
      if (to.name === 'MineOrder') {
        next();
      }
        next({name: 'MineOrder'});
    }
  },
  TradePayedView: {
    beforeRouteEnter: (to, from, next) => {
      next();
    },
    beforeRouteLeave: (to, from, next) => {
      next();
    }
  }
};

class HookManager {
  static hook(routeName) {
    if (hookMap.hasOwnProperty(routeName)) {
      return {...hookMap[routeName]};
    }
    return {};
  }
}

export default HookManager;
